﻿package frEngine.shader
{

    public class ToBuilderInfo extends Object
    {
        public var type:String;
        public var oldVarName:String;
        public var paramName:String;
        public var isGlobleVar:Boolean;
        public var varNum:int;
        public var defaultValue:Object;
        public var isVertex:Boolean;

        public function ToBuilderInfo(param1:String, param2:String, param3:Boolean, param4:int, param5 = null, param6:Program3dRegisterInstance = null)
        {
            this.oldVarName = param1;
            this.paramName = param2;
            if (this.paramName.indexOf("{") != 0 || this.paramName.indexOf("}") != (this.paramName.length - 1))
            {
                throw new Error("名称不合法，请加上{}");
            }
            this.isGlobleVar = param3;
            this.varNum = param4;
            this.type = this.oldVarName.substr(0, 2);
            if (this.type == "vf")
            {
                this.type = "v";
            }
            this.defaultValue = param5;
            if (this.defaultValue is Array)
            {
                this.defaultValue = this.Vector.<Number>(this.defaultValue);
            }
            if (this.type == "va" || this.type == "vc" || this.type == "vm" || this.type == "v" || this.type == "vt")
            {
                this.isVertex = true;
            }
            else
            {
                this.isVertex = false;
            }
            if (param6)
            {
                param6.registParam(this);
            }
            return;
        }// end function

    }
}
